<?
$tittle="Family Safety";
$description="Mobile app development";
?>
<?php 
include('header.php');
$dbhost = 'localhost';
	$dbuser = 'root';
	$dbpass = '';
	$item_per_page = 5;
	$conn = mysql_connect($dbhost, $dbuser, $dbpass);
	mysql_select_db('family_safety');
	$sql = 'SELECT COUNT(*) FROM user_reviews';
	$retval = mysql_query( $sql, $conn );
    $get_total_rows = mysql_fetch_array($retval); //total record
	//echo "<pre>";print_r($get_total_rows);exit;
    $total_pages = ceil($get_total_rows[0]/$item_per_page);
?>

<head>
<meta name="google-translate-customization" content="e9332ec68cfbb5e-4242da345ae62ef4-g70ddf448aee61b80-17"></meta>
</head>
<div class="container min_height">
	<div class="well">
		<div class="title_feature">
			<h2>FACEBOOK AND GOOGLE <span>REVIWES</span></h2>
			<div class="seperate-line"><span><i class="circle_text">&#X25CE;</i></span></div>
		</div>
		<div class="row">
			<div class="span2">
				<h3>Google Reviews</h3>
				<div id="results"></div>
			<div align="center">
				<button class="load_more" id="load_more_button">load More</button>
			</div>
			
			</div>
			<div class="span2">
				<h3>Facebook Reviews</h3></br/>
				<div width="482px" class="fb-comments" data-href="http://localhost/familysafety/" data-numposts="5" data-colorscheme="light"></div>
		    </div>
	    </div>
		<div class="clear"></div>
    </div>
</div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {

	var track_click = 0; 
	
	var total_pages = <?php echo $total_pages; ?>;
	$('#results').load("fetch_pages.php", {'page':track_click}, function() {track_click++;});

	$(".load_more").click(function(e) {
			
		    $.post('fetch_pages.php',{'page': track_click}, function(data) {
			    $(".load_more").show(); 
				$("#results").append(data); 
	            track_click++; 
				if(track_click == totalpages){
				  $("#load_more_button").hide();
				}
			
			})
	});
});
</script>

<script>
(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
	  js = d.createElement(s); js.id = id;
	  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=1503977306482502&version=v2.0";
	  fjs.parentNode.insertBefore(js, fjs);
    }
    (document, 'script', 'facebook-jssdk'));
</script>
<?php include('footer.php')?>